<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="lib/react.development.js"></script>
    <script src="lib/react-dom.development.js"></script>
    <script src="lib/babel.min.js"></script>
</head>
<body>
<div id="root"></div>
</body>
<script type="text/babel">
    const root = ReactDOM.createRoot(document.querySelector("#root"));
    {
        // function声明一个普通函数
        function App(){
            return (
                <div>
                    <h3>App1</h3>
                </div>
            )
        }
        root.render(<App/>)
    }
    {
        // 函数赋值给常量
        const App = function(){
            return (
                <div>
                    <h3>App2</h3>
                </div>
            )
        }
        root.render(<App/>)
    }
    {
        // 使用箭头函数
        const App = ()=>(
            <div>
                <h3>App3</h3>
            </div>
        );
        root.render(<App/>)
    }
    {
        // 组件作为对象的属性
        const my = {
            App(){
                return (
                    <div>
                        <h3>App4</h3>
                    </div>
                )
            }
        };
        const {App} = my;
        root.render((
            <React.Fragment>
                <my.App></my.App>
                <App></App>
            </React.Fragment>
        ))
    }
</script>
</html>